﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_Admin.cshtml";
}

<div class="page-header position-relative">
    <h1>Quản lý cấu hình</h1>
</div>

@using (Html.BeginRouteForm("Admin_default", new { controller = "AdminWebConfig", action = "ChangeInfo" }, FormMethod.Post))
{
    <h4 class="header smaller lighter green">Chỉnh sửa thông tin công ty</h4>
    <div class="form-horizontal">
        <div class="control-group">
            <label class="control-label" for="txtEmail">Email:</label>
            <div class="controls">
                <input type="text" id="txtEmail" name="txtEmail"/>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" for="editorThongTinCongTy">
                Thông tin liên hệ:
            </label>
            <div class="controls">
                <textarea class="ckeditor" cols="80" id="editorThongTinCongTy" name="editorThongTinCongTy" rows="10">
			</textarea>
            </div>
            <br />
            <p class="controls">
                <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>Lưu</button>
            </p>
        </div>

    </div>
}

@using (Html.BeginRouteForm("Admin_default", new { controller = "AdminWebConfig", action = "ChangeIntro" }, FormMethod.Post))
{
    <h4 class="header smaller lighter green">Chỉnh sửa giới thiệu</h4>
    <div class="form-horizontal">
        <div class="control-group">
            <label class="control-label" for="editorGioiThieu">
                Thông tin giới thiệu:
            </label>
            <div class="controls">
                <textarea class="ckeditor" cols="80" id="editorGioiThieu" name="editorGioiThieu" rows="10">
			</textarea>
            </div>
            <br />
            <p class="controls">
                <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>Lưu</button>
            </p>
        </div>
    </div>
}

@using (Html.BeginRouteForm("Admin_default", new { controller = "AdminWebConfig", action = "ChangeInterface" }, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <h4 class="header smaller lighter green">Chỉnh sửa giao diện</h4>
    <div class="form-horizontal">
        <div class="control-group">
            <label for="editorThongTinCongTy" class="control-label">
                Logo hiện tại:
            </label>
            <div class="controls">
                <img src="@ViewBag.getLogoUrl" width="120" height="120"/>
            </div>
            <label for="editorThongTinCongTy" class="control-label">
                Thay đổi logo:
            </label>
            <div class="controls">
                <input type="file" id="input-logo" name="inputlogo"/>
            </div>
            <label class="control-label" for="editorThongTinCongTy">
                Chỉnh sửa màu sắc:
            </label>

            <div class="controls">
                <select id="simple-colorpicker-1" name="inputcolor">
														<option value="#ac725e" />#ac725e
														<option value="#d06b64" />#d06b64
														<option value="#f83a22" />#f83a22
														<option value="#fa573c" />#fa573c
														<option value="#ff7537" />#ff7537
														<option value="#ffad46" selected="" />#ffad46
														<option value="#42d692" />#42d692
														<option value="#16a765" />#16a765
														<option value="#7bd148" />#7bd148
														<option value="#b3dc6c" />#b3dc6c
														<option value="#fbe983" />#fbe983
														<option value="#fad165" />#fad165
														<option value="#92e1c0" />#92e1c0
														<option value="#9fe1e7" />#9fe1e7
														<option value="#9fc6e7" />#9fc6e7
														<option value="#4986e7" />#4986e7
														<option value="#9a9cff" />#9a9cff
														<option value="#b99aff" />#b99aff
														<option value="#c2c2c2" />#c2c2c2
														<option value="#cabdbf" />#cabdbf
														<option value="#cca6ac" />#cca6ac
														<option value="#f691b2" />#f691b2
														<option value="#cd74e6" />#cd74e6
														<option value="#a47ae2" />#a47ae2
														<option value="#555" />#555
													</select>
            </div>
            <br />
            <p class="controls">
                <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>Lưu</button>
            </p>
        </div>
    </div>
}
@section scripts{
    <script src="~/Content/assets/js/bootstrap-colorpicker.js"></script>
    <script src="~/Content/assets/js/jquery.maskedinput.js"></script>
    <script src="~/Content/ckeditor/ckeditor.js"></script>
    
    <script type="text/javascript">

        $(function () {
            //lấy thông tin công ty đổ lên các control
            $.getJSON("AdminWebConfig/GetInfo", function (data) {
                //$('#editorThongTinCongTy').html(data.Info);
                var info = $("<div/>").html(data.Info).text();
                CKEDITOR.instances['editorThongTinCongTy'].setData(info);
                $('#txtEmail').val(data.Email);
            });
            //lấy thông tin giới thiệu đổ lên các control
            $.getJSON("AdminWebConfig/GetIntro", function (data) {
                //$('#editorThongTinCongTy').html(data.Info);
                var info = $("<div/>").html(data.Intro).text();
                CKEDITOR.instances['editorGioiThieu'].setData(info);
            });

            $('#input-logo').ace_file_input({
                no_file: 'No File ...',
                btn_choose: 'Choose',
                btn_change: 'Change',
                droppable: false,
                onchange: null,
                thumbnail: false
            });

            $('#simple-colorpicker-1').ace_colorpicker();
        });


        //$('#simple-colorpicker-1').ace_colorpicker();


    </script>
}
